package lanqiao;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Project : ProgrammingExercises
 * @Package : LanQiao.PrepareForCompetition
 * @File : Q0216.java
 * @Author : WangRuoyu
 * @Date : 2023/3/15 10:52
 */

public class Q0216 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] words = line.split(" ");

        int m = Integer.parseInt(words[0]);
        int n = Integer.parseInt(words[1]);
        int k = Integer.parseInt(words[2]);

        int[][] d = new int[m + 1][n + 1];
        int[][][][] f = new int[m + 1][n + 1][k + 1][14];

        for (int i = 1; i <= m; ++i) {
            line = br.readLine();
            words = line.split(" ");
            for (int j = 1; j <= n; ++j) {
                d[i][j] = Integer.parseInt(words[j - 1]) + 1; // words + 1 是因为会存在价值为0的宝贝，若从0开始可能会出错
            }
        }

        f[1][1][1][d[1][1]] = 1;
        f[1][1][0][0] = 1;
        final int MOD = 1000000007;

        for (int i = 1; i <= m; ++i) {
            for (int j = 1; j <= n; ++j) {
                if (i == 1 && j == 1) {
                    continue;
                }
                for (int l = 0; l <= k; ++l) {
                    for (int o = 0; o <= 13; ++o) {
                        f[i][j][l][o] = (f[i][j][l][o] + f[i - 1][j][l][o]) % MOD;
                        f[i][j][l][o] = (f[i][j][l][o] + f[i][j - 1][l][o]) % MOD;
                        if (l > 0 && d[i][j] == o) {
                            for (int p = 0; p < d[i][j]; ++p) {
                                f[i][j][l][o] = (f[i][j][l][o] + f[i][j - 1][l - 1][p]) % MOD;
                                f[i][j][l][o] = (f[i][j][l][o] + f[i - 1][j][l - 1][p]) % MOD;
                            }
                        }
                    }
                }
            }
        }

        int res = 0;
        for (int i = 0; i < 14; ++i) {
            res = (res + f[m][n][k][i]) % MOD;
        }
        System.out.println(res);
    }
}
